﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>    


		<head>
		<script type="text/javascript" src="<c:url value='/easyui/datagrid-detailview.js'/>"></script>
		<script type="text/javascript">
			$(function(){
				
				  init();
			  
			  
			  
			  
			});

			function init(){
				
				$('#t-dg').datagrid({
				loadMsg:'',
				view:detailview,
				detailFormatter:function(index,row){
				  var content = '';
          
          
          
          if (row.loglevel)  {
   
}
if (row.msg)  {
   content += '<span style="color:blue;font-weight:700">信息内容：</span></br>';
   content += '<div style="padding:5px">'+ row.msg.replace(/\r\n/gi,'<br/>')+'</div>';
}
if (row.debugmsg)  {
   content += '<span style="color:blue;font-weight:700">调试信息：</span></br>';
   content += '<div style="padding:5px">'+ row.debugmsg.replace(/\r\n/gi,'<br/>')+'</div>';
}

           
					return '<div style="padding:5px">' + content + '</div>';
				}
				
			});
				
			
			}
			
			
			
			
			
			
			
			
			
			function deleteItem(){
				var t = $('#t-dg');
				var row = t.datagrid('getSelected');
				if (row){
					$.messager.confirm('删除确认', '是否确定要删除选择日志?', function(r){
						if (r){
					$.ajax({
						url:'<c:url value="/system/Oplog/destroyOplog"/>?id=' + row.id,
						type:'post',
						success:function(){		
							$('#t-dg').datagrid('reload');
						}
					});
						}
						});
				}
			}
			
			function deleteAllItem(){
				
					$.messager.confirm('清空确认', '是否确定要清空所有日志?', function(r){
						if (r){
					$.ajax({
						url:'<c:url value="/system/Oplog/destroyAllOplog"/>' ,
						type:'post',
						success:function(){		
							$('#t-dg').datagrid('reload');
						}
					});
						}
						});
				
			}
			
			function doQuery(value){
				$('#t-dg').datagrid('load', {
					q: value
				});
			}
			
		</script>
	</head>
	<body>
		<div class="easyui-layout" fit="true">
			<div region="north" border="false" style="height:40px;padding:5px;"  >
			<div style="padding-top:3px;float:left">
				<input class="easyui-searchbox" prompt="按信息来源|信息内容进行查询" searcher="doQuery" style="width:300px"></input>
				</div>
				<div style="float:left">
				<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-remove" onclick="deleteItem()">删除日志</a>
				<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-cancel" onclick="deleteAllItem()">清空日志</a>
				</div>
			</div>
			
			
			<div region="center" border="true">
	      <table id="t-dg" style="display:none;"
						url="<c:url value='/system/Oplog/getOplogItems'/>"
						rownumbers="true" singleSelect="true" rownumbers="false" pagination="true"
						border="false" fit="true" fitColumns="true">
					<thead>
						<tr>
							<th field="loglevel" width="40" sortable="true">信息级别</th>
<th field="logfrom" width="80" sortable="true">信息来源</th>
<th field="eddate" width="80" sortable="true">信息时间</th>
<th field="msg" width="300" sortable="false">信息内容</th>

						</tr>
					</thead>
				</table>			
			</div>
		</div>
		
		
		
			
		
		
		
		
	</body>
